package cn.linstudy.blog.utils;

import com.alibaba.fastjson.JSON;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author XiaoLin
 * @Date 2021/12/22 14:07
 * @Description 响应处理工具类
 */
public class ResponseUtils {

    public static <T> void ResponseMeg(HttpServletResponse response, T t) {
        response.setCharacterEncoding("utf-8");
        response.setContentType("application/json;charset=utf-8");
        try {
            response.getWriter().write(JSON.toJSONString(t));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
